<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>机器学习中的数学原理 | 啊粥啊周舟の部落阁</title><meta name="author" content="Zhouwy"><meta name="copyright" content="Zhouwy"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="机器学习中的数学原理第一讲 微积分和梯度主要内容  常数e的计算过程 常见函数的导数 分部积分法及其应用 梯度 上升&#x2F;下降最快方向 凸函数 Jensen不 等式  1、极限例如：求S的值： ​    $S&#x3D;\frac{1}{0 !}+\frac{1}{1 !}+\frac{1}{2 !}+\frac{1}{3 !}+\frac{1}{4 !}+\cdots+\frac{1}{n !}+\cdots">
<meta property="og:type" content="article">
<meta property="og:title" content="机器学习中的数学原理">
<meta property="og:url" content="https://gitee.com/zwyywz/zwyywz.git/2020/03/31/MathematicaOfMachineLearning/index.html">
<meta property="og:site_name" content="啊粥啊周舟の部落阁">
<meta property="og:description" content="机器学习中的数学原理第一讲 微积分和梯度主要内容  常数e的计算过程 常见函数的导数 分部积分法及其应用 梯度 上升&#x2F;下降最快方向 凸函数 Jensen不 等式  1、极限例如：求S的值： ​    $S&#x3D;\frac{1}{0 !}+\frac{1}{1 !}+\frac{1}{2 !}+\frac{1}{3 !}+\frac{1}{4 !}+\cdots+\frac{1}{n !}+\cdots">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/maths.jpg">
<meta property="article:published_time" content="2020-03-31T01:25:00.000Z">
<meta property="article:modified_time" content="2023-04-16T13:05:02.702Z">
<meta property="article:author" content="Zhouwy">
<meta property="article:tag" content="算法">
<meta property="article:tag" content="机器学习">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/maths.jpg"><link rel="shortcut icon" href="/zwyywz/img/favicon.png"><link rel="canonical" href="https://gitee.com/zwyywz/zwyywz.git/2020/03/31/MathematicaOfMachineLearning/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/zwyywz/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/zwyywz/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":300},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Zhouwy","link":"链接: ","source":"来源: 啊粥啊周舟の部落阁","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '机器学习中的数学原理',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-04-16 21:05:02'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="///at.alicdn.com/t/c/font_4018630_wl3l75i04vl.css"><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/zwyywz/img/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/zwyywz/archives/"><div class="headline">文章</div><div class="length-num">17</div></a><a href="/zwyywz/tags/"><div class="headline">标签</div><div class="length-num">29</div></a><a href="/zwyywz/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zwyywz/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分类</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/zwyywz/note/"><i class="fa-fw iconfont icon-xuexibiji"></i><span> 学习笔记</span></a></li><li><a class="site-page child" href="/zwyywz/opensource/"><i class="fa-fw iconfont icon-xiangmu"></i><span> 开源项目</span></a></li><li><a class="site-page child" href="/zwyywz/development/"><i class="fa-fw iconfont icon-peizhi-xitongpeizhi"></i><span> 环境配置</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/zwyywz/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/zwyywz/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/zwyywz/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://blog-1300216920.cos.ap-nanjing.myqcloud.com/maths.jpg')"><nav id="nav"><span id="blog-info"><a href="/zwyywz/" title="啊粥啊周舟の部落阁"><span class="site-name">啊粥啊周舟の部落阁</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zwyywz/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 分类</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/zwyywz/note/"><i class="fa-fw iconfont icon-xuexibiji"></i><span> 学习笔记</span></a></li><li><a class="site-page child" href="/zwyywz/opensource/"><i class="fa-fw iconfont icon-xiangmu"></i><span> 开源项目</span></a></li><li><a class="site-page child" href="/zwyywz/development/"><i class="fa-fw iconfont icon-peizhi-xitongpeizhi"></i><span> 环境配置</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 清单</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/zwyywz/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/zwyywz/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/zwyywz/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/zwyywz/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">机器学习中的数学原理</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-03-31T01:25:00.000Z" title="发表于 2020-03-31 09:25:00">2020-03-31</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-04-16T13:05:02.702Z" title="更新于 2023-04-16 21:05:02">2023-04-16</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="机器学习中的数学原理"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="机器学习中的数学原理"><a href="#机器学习中的数学原理" class="headerlink" title="机器学习中的数学原理"></a>机器学习中的数学原理</h1><h2 id="第一讲-微积分和梯度"><a href="#第一讲-微积分和梯度" class="headerlink" title="第一讲 微积分和梯度"></a>第一讲 微积分和梯度</h2><p>主要内容</p>
<ul>
<li>常数e的计算过程</li>
<li>常见函数的导数</li>
<li>分部积分法及其应用</li>
<li>梯度</li>
<li>上升/下降最快方向</li>
<li>凸函数</li>
<li>Jensen不 等式</li>
</ul>
<h3 id="1、极限"><a href="#1、极限" class="headerlink" title="1、极限"></a>1、极限</h3><p>例如：求S的值：</p>
<p>​    $S=\frac{1}{0 !}+\frac{1}{1 !}+\frac{1}{2 !}+\frac{1}{3 !}+\frac{1}{4 !}+\cdots+\frac{1}{n !}+\cdots$</p>
<p>==夹逼定理==</p>
<blockquote>
<p> 在某-域上,若9(x)≤f(x)≤h(x),同时我们还知道， 当x趋向a时，9(x)的极限<br> 等于L，以及当x趋向a时，h(x)的极限也等于L，那么夹逼定理告诉我们:当x趋向a时，f(x)的极限也一 定等于L。</p>
</blockquote>
<p>可以求出对数函数的上升速度：</p>
<p>问题分析：令f(x)= log<sub>a</sub>X,则:</p>
<script type="math/tex; mode=display">
\begin{aligned}
&\frac{f(x+\Delta x)-f(x)}{\Delta x}=\frac{\log _{a}(x+\Delta x)-\log _{a} x}{\Delta x}=\frac{\log _{a}\left(\frac{x+\Delta x}{x}\right)}{\Delta x}=\log _{a}\left(\frac{x+\Delta x}{x}\right)^{\frac{1}{\Delta x}}
\end{aligned}</script><script type="math/tex; mode=display">
\stackrel{\because x=1}{\longrightarrow} \log _{a}(1+\Delta x)^{\frac{1}{\Delta x}}=1 \Rightarrow \lim _{\Delta x \rightarrow 0}(1+\Delta x)^ \frac{1}{\Delta x}=a</script><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> math</span><br><span class="line"><span class="keyword">import</span> matplotlib. pyplot <span class="keyword">as</span> plt</span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"></span><br><span class="line">x = np.arange(<span class="number">0.05</span>, <span class="number">3</span>, <span class="number">0.05</span>)</span><br><span class="line">y1=[math.log(a, <span class="number">1.5</span>)  <span class="keyword">for</span> a <span class="keyword">in</span> x]</span><br><span class="line">plt.plot(x, y1, linewidth=<span class="number">2</span>, color=<span class="string">&#x27;#007500&#x27;</span>, label=<span class="string">&#x27;log1.5(x)&#x27;</span>)</span><br><span class="line">plt.plot([<span class="number">1</span>,<span class="number">1</span>],[y1[<span class="number">0</span>], y1[-<span class="number">1</span>]],<span class="string">&quot;r--&quot;</span>, linewidth=<span class="number">2</span>)</span><br><span class="line">y2 = [math.log(a, <span class="number">2</span>) <span class="keyword">for</span> a <span class="keyword">in</span> x]</span><br><span class="line">plt.plot(x, y2, linewidth=<span class="number">2</span>, color=<span class="string">&#x27;#9F35FF&#x27;</span>, label=<span class="string">&#x27;log2(x)&#x27;</span>)</span><br><span class="line">y3 = [math.log(a, <span class="number">3</span>) <span class="keyword">for</span> a <span class="keyword">in</span> x]</span><br><span class="line">plt.plot(x, y3, linewidth=<span class="number">2</span>, color=<span class="string">&#x27;#F75000&#x27;</span> , label=<span class="string">&#x27;1og3(x)&#x27;</span>)</span><br><span class="line">plt. legend(loc=<span class="string">&#x27;lower right&#x27;</span>)</span><br><span class="line">plt. grid(<span class="literal">True</span>)</span><br><span class="line">plt.savefig(<span class="string">&#x27;./test.jpg&#x27;</span>)</span><br><span class="line">plt. show()</span><br></pre></td></tr></table></figure>
<p><img src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/test.jpg" alt=""></p>
<p>问：   </p>
<script type="math/tex; mode=display">
\lim _{n \rightarrow \infty}\left(1+\frac{1}{n}\right)^{n}=?</script><p>显然：由高度数学可知：</p>
<script type="math/tex; mode=display">
\lim _{n \rightarrow \infty}\left(1+\frac{1}{n}\right)^{n}=e</script><p>推到过程：</p>
<script type="math/tex; mode=display">
\begin{array}{l}
x_{n}=\left(1+\frac{1}{n}\right)^{n} \\
=1+C_{n}^{1} \frac{1}{n}+C_{n}^{2} \frac{1}{n^{2}}+C_{n}^{3} \frac{1}{n^{3}}+\cdots+C_{n}^{n} \frac{1}{n^{n}} \\
=1+n \cdot \frac{1}{n}+\frac{n(n-1)}{2 !} \cdot \frac{1}{n^{2}}+\frac{n(n-1)(n-2)}{3 !} \cdot \frac{1}{n^{3}}+\cdots+\frac{n(n-1)(n-2) \cdots 1}{n !} \cdot \frac{1}{n^{n}} \\
=1+1+\frac{1}{2 !} \cdot\left(1-\frac{1}{n}\right)+\frac{1}{3 !} \cdot\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)+\cdots+\frac{1}{n !} \cdot\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right) \cdots\left(1-\frac{n-1}{n}\right)
<1+1+\frac{1}{2 !}+\frac{1}{3 !}+\cdots+\frac{1}{n !} \\
<1+1+\frac{1}{2}+\frac{1}{2^{2}}+\cdots+\frac{1}{2^{n-1}} \\
=3-\frac{1}{2^{n-1}} \\
<3
\end{array}</script><p>由此，{<em>Xn</em>}是有上界的。</p>
<script type="math/tex; mode=display">
x_{n+1}-x_{n}>\frac{1}{(n+1)} \cdot\left(1-\frac{1}{n+1}\right)\left(1-\frac{2}{n+1}\right) \cdots\left(1-\frac{n}{n+1}\right)>0</script><p>由此，{<em>Xn</em>}是单增的。</p>
<p>根据极限存在定义；这个极限一定是存在的。而且这是数大于2小于3。故而。我们将这个数记为:e</p>
<p>==自然常数：==$\lim _{x \rightarrow \infty}\left(1+\frac{1}{x}\right)^{x}=e$</p>
<p>根据前文      $a_{n}=\left(1+\frac{1}{n}\right)^{n}$中的二项展开式，已经证明数组{a<sub>n</sub>}单增有上界，因此，必有极限，记做e。对实数x，总存在整数n，使得n≤x≤n+1，得:</p>
<script type="math/tex; mode=display">
\begin{array}{c}
\left(1+\frac{1}{n+1}\right)^{n}<\left(1+\frac{1}{x}\right)^{x}<\left(1+\frac{1}{n}\right)^{n+1} \\
\lim _{n \rightarrow \infty}\left(1+\frac{1}{n+1}\right)^{n}=\lim _{n \rightarrow \infty} \frac{\left(1+\frac{1}{n+1}\right)^{n+1}}{1+\frac{1}{n+1}}=\frac{\lim _{n \rightarrow \infty}\left(1+\frac{1}{n+1}\right)^{n+1}}{\lim _{n \rightarrow \infty}\left(1+\frac{1}{n+1}\right)}=\frac{e}{1+0}=e \\
\lim _{n \rightarrow \infty}\left(1+\frac{1}{n}\right)^{n+1}=\lim _{n \rightarrow \infty}\left(\left(1+\frac{1}{n}\right)^{n}\left(1+\frac{1}{n}\right)\right)=\lim _{n \rightarrow \infty}\left(1+\frac{1}{n}\right)^{n} \cdot \lim _{n \rightarrow \infty}\left(1+\frac{1}{n}\right)=e \cdot(1+0)=e
\end{array}</script><p>根据夹逼定理，函数$f(x)=\left(1+\frac{1}{x}\right)^{x}$的极限必然存在且为e。</p>
<h3 id="2、导数"><a href="#2、导数" class="headerlink" title="2、导数"></a>2、导数</h3><p>简单的说，导数就是曲线的斜率，是曲线变化快慢的反应。二阶导数是斜率变化快慢的反应，表征曲线凸凹性。二阶导数连续的曲线，往往称之为“光顺”的。还记得高中物理老师时常念叨的吗:加速度的方向总是<br>指向轨迹曲线凹的一侧。根据$\lim _{x \rightarrow \infty}\left(1+\frac{1}{x}\right)^{x}=e$可以得到函数$f(x)=\ln x$的导数，进一步根据换底公式、反函数求导等，得到其他初等函数的导数。</p>
<script type="math/tex; mode=display">
\begin{array}{cc}
C^{\prime}=0 & \left(x^{n}\right)^{\prime}=n x^{n-1} \\
(\sin x)^{\prime}=\cos x & (\cos x)^{\prime}=-\sin x \\
\left(a^{x}\right)^{\prime}=a^{x} \ln a & \left(e^{x}\right)^{\prime}=e^{x} \\
\left(\log _{a} x\right)^{\prime}=\frac{1}{x} \log _{a} e & (\ln x)^{\prime}=\frac{1}{x} \\
(u+v)^{\prime}-u^{\prime}+v^{\prime} & (u v)^{\prime}=u^{\prime} v+u v^{\prime}
\end{array}</script><p>掌握高等数学中的分部积分法、凑微分法、换元法….</p>
<script type="math/tex; mode=display">
N^{\frac{1}{\log N}}= ?</script><p>在计算机算法跳跃表SkipList的分析中，用到了该常数。背景:跳表是支持增删改查的动态数据结构，能够达到与平衡二叉树、红黑树近似的效率，而代码实现简单。</p>
<p>积分应用：$N \rightarrow \infty \Rightarrow \ln N ! \rightarrow N(\ln N-1)$</p>
<script type="math/tex; mode=display">
\begin{array}{l}
\ln N !=\sum_{i=1}^{N} \ln i \approx \int_{1}^{N} \ln x d x \\
=\left.x \ln x\right|_{1} ^{N}-\int_{1}^{N} x d \ln x \\
=N \ln N-\int_{1}^{N} \quad x \cdot \frac{1}{x} d x \\
=N \ln N-\left.x\right|_{1} ^{N} \\
=N \ln N-N+1 \\
\rightarrow N \ln N-N
\end{array}</script><h3 id="3、方向导数"><a href="#3、方向导数" class="headerlink" title="3、方向导数"></a>3、方向导数</h3><p>如果函数Z=f(x，y)在点P(x,y)是可微分的，那么，函数在该点沿任一方向L的方向导数都存在，且有:</p>
<script type="math/tex; mode=display">
\frac{\partial f}{\partial l}=\frac{\partial f}{\partial x} \cos \varphi+\frac{\partial f}{\partial y} \sin \varphi</script><p>其中,ψ为x轴到方向L的转角。</p>
<h3 id="4、梯度"><a href="#4、梯度" class="headerlink" title="4、梯度"></a>4、梯度</h3><p>设函数z=f(x,y)在平面区域D内具有一阶连续偏导数，则对于每一个点P(x,y)∈D，向量</p>
<p>$\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)$</p>
<p>为函数z=f(x,y)在点P的梯度，记做gradf(x,y)。梯度的方向是函数在该点变化最快的方向</p>
<h3 id="5、凸函数"><a href="#5、凸函数" class="headerlink" title="5、凸函数"></a>5、凸函数</h3><p>若函数f的定义域domf为凸集，且满足：</p>
<script type="math/tex; mode=display">
\begin{array}{l}
\forall x, y \in \operatorname{dom} f, 0 \leq \theta \leq 1, \text { 有 } \\
f(\theta x+(1-\theta) y) \leq \theta f(x)+(1-\theta) f(y)
\end{array}</script><p><img src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/image-20210401105231130.png" alt=""></p>
<p>==注：在机器学习中，凸函数和凹函数的定义与高等数学相反==</p>
<p>若f一阶可微，则函数f为凸函数当前仅当f的定义域domf为凸集，且</p>
<script type="math/tex; mode=display">
\forall x, y \in \operatorname{dom} f, f(y) \geq f(x)+\nabla f(x)^{T}(y-x)</script><p><img src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/image-20210401105748209.png" alt=""></p>
<p>结合凸函数图像和支撑超平面理解该问题。对于凸函数，其一阶Taylor近似本质上是该<br>函数的全局下估计。反之，如果一个函数的一阶Taylor近似总是起全局下估计，则该函数是凸函数。<br>该不等式说明从一个函数的局部信息，可以得到一定程度的全局信息。与机器学习领域中的凸优化相联系。</p>
<h3 id="6、Jensen不等式"><a href="#6、Jensen不等式" class="headerlink" title="6、Jensen不等式"></a>6、Jensen不等式</h3><p>若f是凸函数：$f(\theta x+(1-\theta) y) \leq \theta f(x)+(1-\theta) f(y)$</p>
<p>若 $\theta<em>{1}, \ldots, \theta</em>{k} \geq 0, \theta<em>{1}+\cdots+\theta</em>{k}=1$，则 $f\left(\theta<em>{1} x</em>{1}+\cdots+\theta<em>{k} x</em>{k}\right) \leq \theta<em>{1} f\left(x</em>{1}\right)+\cdots+\theta<em>{k} f\left(x</em>{k}\right)$</p>
<p>若 $p(x) \geq 0$ on $S \subseteq \operatorname{dom} f, \int<em>{S} p(x) d x=1$，则 $f\left(\int</em>{S} p(x) x d x\right) \leq \int_{S} f(x) p(x) d x$</p>
<blockquote>
<p>可以推导得出：$f(\mathbf{E} x) \leq \mathbf{E} f(x)$</p>
</blockquote>
<p>Jensen不等式是几乎所有不等式的基础，例如：利用y=-logx是凸函数，证明:$\frac{a+b}{2} \geq \sqrt{a b}, \quad a&gt;0, b&gt;0$<br>提示:任取a,b&gt;0，θ=0.5带入 基本Jensen不等式，利用f(E(x))≤E(f(x))，(f是 凸函数)，证明下式D≥0</p>
<script type="math/tex; mode=display">
D(p \| q)=\sum_{x} p(x) \log \frac{p(x)}{q(x)}=E_{p(x)} \log \frac{p(x)}{q(x)}>0</script><p><img src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/image-20210401110909370.png" alt=""></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://gitee.com/zwyywz/zwyywz.git">Zhouwy</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://gitee.com/zwyywz/zwyywz.git/2020/03/31/MathematicaOfMachineLearning/">https://gitee.com/zwyywz/zwyywz.git/2020/03/31/MathematicaOfMachineLearning/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://gitee.com/zwyywz/zwyywz.git" target="_blank">啊粥啊周舟の部落阁</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/zwyywz/tags/%E7%AE%97%E6%B3%95/">算法</a><a class="post-meta__tags" href="/zwyywz/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a></div><div class="post_share"><div class="social-share" data-image="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/maths.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/zwyywz/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="/zwyywz/img/wechat.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/zwyywz/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/zwyywz/img/alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/zwyywz/2020/04/01/DeepLearningAndTensorFlow/" title="深度学习与TensorFlow"><img class="cover" src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/deep_learning.png" onerror="onerror=null;src='/zwyywz/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">深度学习与TensorFlow</div></div></a></div><div class="next-post pull-right"><a href="/zwyywz/2019/09/07/%E5%8F%8C%E6%97%8B%E7%BF%BC%E9%A3%9E%E8%A1%8C%E5%99%A8/" title="升降式双旋翼飞行器"><img class="cover" src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/下载.jpg" onerror="onerror=null;src='/zwyywz/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">升降式双旋翼飞行器</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/zwyywz/2021/03/26/DataStructAndAlgorithms/" title="数据结构与算法(C&#x2F;C++实现)"><img class="cover" src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/数据结构与算法.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-26</div><div class="title">数据结构与算法(C&#x2F;C++实现)</div></div></a></div><div><a href="/zwyywz/2020/04/01/DeepLearningAndTensorFlow/" title="深度学习与TensorFlow"><img class="cover" src="https://blog-1300216920.cos.ap-nanjing.myqcloud.com/deep_learning.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-01</div><div class="title">深度学习与TensorFlow</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E7%9A%84%E6%95%B0%E5%AD%A6%E5%8E%9F%E7%90%86"><span class="toc-number">1.</span> <span class="toc-text">机器学习中的数学原理</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E8%AE%B2-%E5%BE%AE%E7%A7%AF%E5%88%86%E5%92%8C%E6%A2%AF%E5%BA%A6"><span class="toc-number">1.1.</span> <span class="toc-text">第一讲 微积分和梯度</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E6%9E%81%E9%99%90"><span class="toc-number">1.1.1.</span> <span class="toc-text">1、极限</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E5%AF%BC%E6%95%B0"><span class="toc-number">1.1.2.</span> <span class="toc-text">2、导数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E6%96%B9%E5%90%91%E5%AF%BC%E6%95%B0"><span class="toc-number">1.1.3.</span> <span class="toc-text">3、方向导数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81%E6%A2%AF%E5%BA%A6"><span class="toc-number">1.1.4.</span> <span class="toc-text">4、梯度</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5%E3%80%81%E5%87%B8%E5%87%BD%E6%95%B0"><span class="toc-number">1.1.5.</span> <span class="toc-text">5、凸函数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6%E3%80%81Jensen%E4%B8%8D%E7%AD%89%E5%BC%8F"><span class="toc-number">1.1.6.</span> <span class="toc-text">6、Jensen不等式</span></a></li></ol></li></ol></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By Zhouwy</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/zwyywz/js/utils.js"></script><script src="/zwyywz/js/main.js"></script><script src="/zwyywz/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.1
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container').forEach(node => {
            if (node.hasAttribute('display')) {
              btf.wrap(node, 'div', { class: 'mathjax-overflow' })
            } else {
              btf.wrap(node, 'span', { class: 'mathjax-overflow' })
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax/es5/tex-mml-chtml.min.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typesetPromise()
}</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>